package firstStage.part5;

/**
 * @ClassName: [MethodDemo6]
 * @Description:
 * @Author: [黄劲松]
 * @CreateDate: [2021-02-06]
 * @Version: [v1.0]
 */
public class MethodDemo6 {
    public static void main(String[] args) {
        int[] arr = {11, 22, 933, 44, 55, 663};
        printArry(arr);
        int number = getArrayMax(arr);
        System.out.println(number);
    }

    public static void printArry(int[] arr) {
        System.out.print("{");
        for (int i = 0; i < arr.length; i++) {
            if (i == arr.length - 1) {
                System.out.print(arr[i]);
            } else {
                System.out.print(arr[i] + ", ");
            }
        }
        System.out.println("}");
    }

    public static int getArrayMax(int[] arr) {
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        return max;
    }
}
